//package com.nbjtjc.safe.config;
//
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.annotation.Resource;
//import javax.sql.DataSource;
//
///**
// * @author 小泽玛丽罗
// */
//@Configuration
//@MapperScan(value = "com.nbjtjc.safe.mapper", sqlSessionFactoryRef = "safeSqlSessionFactory"
//        , sqlSessionTemplateRef = "safeSqlSessionTemplate")
//public class SafeDatabaseConfig {
//
//    @Resource
//    private DataSource dataSource;
//
//    @Bean(name = "safeSqlSessionFactory")
//    public SqlSessionFactory sqlSessionFactory()
//            throws Exception {
//        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//        sqlSessionFactoryBean.setDataSource(dataSource);
//        sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
//                .getResources("classpath:mapping/*.xml"));
//        sqlSessionFactoryBean.setTypeAliasesPackage("com.nbjtjc.safe.model");
//        return sqlSessionFactoryBean.getObject();
//    }
//
//    @Bean(name = "safeTransactionManager")
//    public DataSourceTransactionManager dataSourceTransactionManager(
//            ) {
//        return new DataSourceTransactionManager(dataSource);
//    }
//
//    @Bean(name = "safeSqlSessionTemplate")
//    public SqlSessionTemplate SqlSessionTemplate(
//            @Qualifier("safeSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
//        return new SqlSessionTemplate(sqlSessionFactory);
//    }
//}
